{include file="public/layout" /}
<body class="laytp-container">
<div class="layui-card" id="search-form">
	<div class="layui-card-body">
  		<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
      <div class="layui-card layui-col-md12">
				<div class="layui-card-header">
					{if !$info['id']}<i class="fa fa-plus"></i> 添加配送员{else}<i class="fa fa-pencil"></i> 编辑配送员{/if}
					<i class="layui-icon layui-icon-close" style="font-size:18px;font-weight:bold;cursor:pointer" onclick="closeself()"></i>
				</div>
				<div class="layui-card-body" pad15>
					<div class="layui-form">
						<input type="hidden" name="info[id]" value="{$info.id}"/>
						<div class="layui-form-item">
							<label class="layui-form-label">姓名：</label>
							<div class="layui-input-inline" style="width:200px">
								<input type="text" name="info[realname]" lay-verify="required" lay-verType="tips" class="layui-input" value="{$info.realname}">
							</div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label">手机号：</label>
							<div class="layui-input-inline" style="width:200px">
								<input type="text" name="info[tel]" lay-verify="required" lay-verType="tips" class="layui-input" value="{$info.tel}">
							</div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label">{:t('会员')}ID：</label>
							<div class="layui-input-inline" style="width:200px">
								<input type="text" name="info[user_id]" lay-verify="required" lay-verType="tips" class="layui-input" value="{$info.user_id}">
							</div>
							<div class="layui-form-mid layui-word-aux" style="margin-left:10px;" id="member_name"></div>
							<div class="layui-btn layui-btn-primary" style="float:left" onclick="showChoosUser()">选择会员</div>
						</div>
						<script>
							var chooseUserLayer;
							function showChoosUser(){
								chooseUserLayer = layer.open({type:2,title:'选择会员',content:"{:url('Users/chooseuser')}/args/1",area:['1000px','600px'],shadeClose:true});
							}
							function chooseuser(res,args) {
								console.log(res);
								var detail = res;
								$('#member_name').html('会员id:'+detail.user_id+' 昵称:'+detail.nickname);
								$('input[name="info[user_id]"]').val(detail.user_id);
							}
						</script>
						<div class="layui-form-item">
							<label class="layui-form-label">序号：</label>
							<div class="layui-input-inline">
								<input type="text" name="info[sort]" value="{$info.sort|default=0}" class="layui-input">
							</div>
							<div class="layui-form-mid layui-word-aux" style="margin-left:10px;">用于排序,越大越靠前</div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label">状态：</label>
							<div class="layui-input-inline">
								<input type="radio" name="info[status]" value="1" title="开启" {if !$info['id'] || $info['status']==1}checked{/if}>
								<input type="radio" name="info[status]" value="0" title="关闭" {if $info['id'] && $info['status']==0}checked{/if}>
							</div>
						</div>

						<div class="layui-form-item">
							<div class="layui-input-block">
								<button class="layui-btn" lay-submit lay-filter="formsubmit">提 交</button>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
  </div>
	</div>
</div>
	<script charset="utf-8" src="https://map.qq.com/api/js?v=2.exp&key={$sysset_webinfo.map_key_qq}"></script>
	<script>
	//var ueditor = UE.getEditor('content');
	layui.form.on('submit(formsubmit)', function(obj){
		var field = obj.field
		//field['info[content]'] = ueditor.getContent();
		//console.log(field);return;
		var index = layer.load();
		$.post("{:url('save')}",field,function(data){
			layer.close(index);
			dialog(data.msg,data.status);
			if(data.status == 1){
				setTimeout(function(){
					parent.layer.close(parent.layer.getFrameIndex(window.name));
					parent.tableIns.reload()
				},1000)
			}
		})
	})
  </script>
</body>
</html>